<template>
    <div class="header">
        <div class="name">{{name}}</div>
        <div class="out" @click="out">退出</div>
    </div>
</template>


<script >
export default {
    data() {
        return {
            name:sessionStorage.getItem('loginUser').substring(sessionStorage.getItem('loginUser').indexOf("name")+7,sessionStorage.getItem('loginUser').indexOf('","picture'))
        }
    },
    methods:{
        out(){
            sessionStorage.removeItem("loginUser");
            sessionStorage.removeItem("token");
            sessionStorage.clear();
            this.$router.push({
                name: "login",
            });
        }
    }
    }
</script>

<style>
.header{
    background-color:#e8e8e8;
    height: 40px;
    padding: 0;
    display: flex;
    justify-content: end;
}
.out ,.name{
    margin-right: 30px;
    line-height:40px;
}
.out{
    cursor:pointer;
}
.out:hover{
    color: #376d99;
}

</style>

